// parola.cxx
//
// Copyright (C) 2011, 2012 - Massimiliano Maniscalco
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "parola.h"

const Glib::ustring Parola::_godanTable ( "うわいうえおくかきくけこぐがぎぐげごすさしすせそつたちつてとぬなにぬねのぶばびぶべぼむまみむめもるらりるれろ" );
const Glib::ustring Parola::_arrayTipi[TOTALE_TIPI] = { "nome", "agg.vo i", "agg.vo na", "v. godan tr.", "v. godan intr.", "v. ichidan tr.", "v. ichidan intr.", "v. irregolare", "posposizione", "avverbio" };

void Parola::
set_tipo_from_name ( const Glib::ustring &str )
{
	_tipo = get_tipo_index_from_name ( str ) + 1;
}

char Parola::
get_tipo_index_from_name ( const Glib::ustring &str )
{
	for ( char index = 0; index < TOTALE_TIPI; index++ )
	{
		if ( str == _arrayTipi[index] )
			return index;
	}
	return -1;
}

Glib::ustring Parola::
get_tipo_name ( void ) const
{
	Glib::ustring _text;
	switch ( _tipo )
	{
		case 1:
			_text = "nome";
			break;
		case 2:
			_text = "agg.vo i";
			break;
		case 3:
			_text = "agg.vo na";
			break;
		case 4:
			_text = "v. godan tr.";
			break;
		case 5:
			_text = "v. godan intr.";
			break;
		case 6:
			_text = "v. ichidan tr.";
			break;
		case 7:
			_text = "v. ichidan intr.";
			break;
		case 8:
			_text = "v. irregolare";
			break;
		case 9:
			_text = "posposizione";
			break;
		case 10:
			_text = "avverbio";
			break;
		default:
			_text = "????";
	}
	return _text;
}

bool Parola::
get_kanji_list ( list<Glib::ustring> &lista ) const
{
	Glib::ustring::const_iterator _iter = _kotoba.begin();
	Glib::ustring::const_iterator _end = _kotoba.end();
	while ( _iter != _end )
	{
		if ( (*_iter >= 0x4E00 && *_iter <= 0x9FCF) || (*_iter >= 0x3400 && *_iter <= 0x4DBF) || (*_iter >= 0x20000 && *_iter <= 0x2A6DF) || (*_iter >= 0x2A700 && *_iter <= 0x2B73F) || (*_iter >= 0x2B740 && *_iter <= 0x2B81F) || (*_iter >= 0x2F800 && *_iter <= 0x2FA1F) || (*_iter >= 0xF900 && *_iter <= 0xFAFF) )
			lista.push_back (Glib::ustring (1, *_iter));
		_iter++;
	}
	return ( lista.size() > 0 );
}

void Parola::
get_forme_list ( list<Glib::ustring> &lista ) const
{
	Glib::ustring str ( "" );
	switch ( _tipo )
	{
		case 1:	// nome
			lista.push_back ( _kotoba );
			break;
		case 2:	// aggettivo i
			lista.push_back ( _kotoba );
			lista.push_back ( _kotoba.substr (0, _kotoba.size() - 1) + "く" );
			lista.push_back ( _kotoba.substr (0, _kotoba.size() - 1) + "かった" );
			break;
		case 3:	// aggettivo na
			lista.push_back ( _kotoba + "な" );
			lista.push_back ( _kotoba + "に" );
			lista.push_back ( _kotoba );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			for ( char n = 1; n <= 5; n++)
			{
				get_verbo_base ( str, n );
				lista.push_back ( str );
			}
			get_verbo_in_te ( str );
			lista.push_back ( str );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			lista.push_back ( _kotoba.substr (0, _kotoba.size() - 1) );
			get_verbo_in_te ( str );
			lista.push_back ( str );
			break;
	}
}

void Parola::
get_presente ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	Glib::ustring base ( "" );
	Glib::ustring suffisso ( "" );
	switch ( _tipo )
	{
		case 1:	// nome
			str.assign ( "" );
			break;
		case 2:	// aggettivo i
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba + Glib::ustring ( "です" ) );
				else
					str.assign ( _kotoba );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くないです" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くない" ) );
			}
			break;
		case 3: // aggettivo na
			if ( _affermativa )
			{
				if ( _cortese )
					suffisso.assign ( "です" );
				else
					suffisso.assign ( "だ" );
			}
			else
			{
				if ( _cortese )
					suffisso.assign ( "ではありません" );
				else
					suffisso.assign ( "ではない" );
			}
			str.assign ( _kotoba + suffisso );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			if ( _affermativa )
			{
				if ( _cortese )
				{
					get_verbo_base ( base, 2 );
					str.assign ( base + Glib::ustring ( "ます" ) );
				}
				else
					str.assign ( _kotoba );
			}
			else
			{
				if ( _cortese )
				{
					get_verbo_base ( base, 2 );
					str.assign ( base + Glib::ustring ( "ません" ) );
				}
				else
				{
					get_verbo_base ( base, 1);
					str.assign ( base + Glib::ustring ( "ない" ) );
				}
			}
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ます" ) );
				else
					str.assign ( _kotoba );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ません" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ない" ) );
			}
			break;
	}
}

void Parola::
get_passato ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	Glib::ustring base ( "" );
	Glib::ustring suffisso ( "" );
	switch ( _tipo )
	{
		case 1:	// nome
			str.assign ( "" );
			break;
		case 2:	// aggettivo i
			if ( _affermativa )
			{
				if ( _cortese )
					suffisso.assign ( "かったです" );
				else
					suffisso.assign ( "かった" );
			}
			else
			{
				if ( _cortese )
					suffisso.assign ( "くなかったです" );
				else
					suffisso.assign ( "くなかった" );
			}
			str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + suffisso );
			break;
		case 3: // aggettivo na
			if ( _affermativa )
			{
				if ( _cortese )
					suffisso.assign ( "でした" );
				else
					suffisso.assign ( "だった" );
			}
			else
			{
				if ( _cortese )
					suffisso.assign ( "ではありませんでした" );
				else
					suffisso.assign ( "ではなかった" );
			}
			str.assign ( _kotoba + suffisso );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			if ( _affermativa )
			{
				if ( _cortese )
				{
					get_verbo_base ( base, 2 );
					str.assign ( base + Glib::ustring ( "ました" ) );
				}
				else
				{
					get_verbo_in_te ( suffisso, true );
					str.assign ( suffisso );
				}
			}
			else
			{
				if ( _cortese )
				{
					get_verbo_base ( base, 2 );
					str.assign ( base + Glib::ustring ( "ませんでした" ) );
				}
				else
				{
					get_verbo_base ( base, 1);
					str.assign ( base + Glib::ustring ( "なかった" ) );
				}
			}
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ました" ) );
				else
				{
					get_verbo_in_te ( suffisso, true );
					str.assign ( suffisso );
				}
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ませんでした" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "なかった" ) );
			}
			break;
	}
}

void Parola::
get_sospensivo ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	switch ( _tipo )
	{
		case 1:	// nome
			str.assign ( "" );
			break;
		case 2:	// aggettivo i
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "く" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くて" ) );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなく" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなくて" ) );
			}
			break;
		case 3: // aggettivo na
			str.assign ( _kotoba + Glib::ustring ( "で" ) );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			get_verbo_base ( str, 2 );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			get_verbo_in_te ( str );
			break;
	}
}

void Parola::
get_causale ( Glib::ustring &str ) const
{
	switch ( _tipo )
	{
		case 1:	// nome
			str.assign ( "" );
			break;
		case 2:	// aggettivo i
			str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くて" ) );
			break;
		case 3: // aggettivo na
			str.assign ( _kotoba + Glib::ustring ( "で" ) );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			get_verbo_in_te ( str );
			break;
	}
}

void Parola::
get_avverbiale ( Glib::ustring &str ) const
{
	switch ( _tipo )
	{
		case 2:	// aggettivo i
			str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "く" ) );
			break;
		case 3: // aggettivo na
			str.assign ( _kotoba + Glib::ustring ( "に" ) );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			get_verbo_in_te ( str );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_diventare ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	switch ( _tipo )
	{
		case 2:	// aggettivo i
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなります" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなる" ) );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなりません" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くならない" ) );
			}
			break;
		case 3: // aggettivo na
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba + Glib::ustring ( "になります" ) );
				else
					str.assign ( _kotoba + Glib::ustring ( "になる" ) );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba + Glib::ustring ( "になりません" ) );
				else
					str.assign ( _kotoba + Glib::ustring ( "にならない" ) );
			}
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_rendere ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	switch ( _tipo )
	{
		case 2:	// aggettivo i
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くします" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くする" ) );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くしません" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くしない" ) );
			}
			break;
		case 3: // aggettivo na
			if ( _affermativa )
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "にします" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "にする" ) );
			}
			else
			{
				if ( _cortese )
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "にしません" ) );
				else
					str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "にしない" ) );
			}
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_desiderativo ( Glib::ustring &str, bool _affermativa )
{
	Glib::ustring ausiliare = _affermativa ? Glib::ustring ( "たい" ) : Glib::ustring ( "たくない" );
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			get_verbo_base ( str, 2 );
			str += ausiliare;
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + ausiliare );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_volitivo ( Glib::ustring &str, bool _cortese, bool _affermativa ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			if ( _affermativa )
			{
				if ( _cortese )
				{
					get_verbo_base ( str, 2 );
					str += Glib::ustring ( "ましょう" );
				}
				else
				{
					get_verbo_base ( str, 5 );
					str += Glib::ustring ( "う" );
				}
			}
			else
			{
				Glib::ustring ausiliare ( "まい" );
				if ( _tipo == 8 )
					get_verbo_base ( str, 1 );
				else
					get_verbo_base ( str, 3 );
				str += ausiliare;
			}
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			if ( _affermativa )
				str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ましょう" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "よう" ) );
			else
				str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "まい" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_esortativo ( Glib::ustring &str, bool _cortese ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			if ( _cortese )
			{
				get_verbo_base ( str, 2 );
				str += Glib::ustring ( "ましょうか" );
			}
			else
			{
				get_verbo_base ( str, 5 );
				str += Glib::ustring ( "うか" );
			}
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ましょうか" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "ようか" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_imperativo ( Glib::ustring &str, bool _affermativa ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
			if ( _affermativa )
				get_verbo_base ( str, 4 );
			else
			{
				get_verbo_base ( str, 3 );
				str += Glib::ustring ( "な" );
			}
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			if ( _affermativa )
				str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "よ" ) );
			else
				str.assign ( _kotoba + Glib::ustring ( "な" ) );
			break;
		case 8:	// verbo irregolare
			if ( _affermativa )
				str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来い" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "せよ" ) );
			else
				str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来るな" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "するな" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_obbligo ( Glib::ustring &str, bool _cortese ) const
{
	switch ( _tipo )
	{
		case 2:	// aggettivo i
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなくてわなりません" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "くなくてわならない" ) );
			break;
		case 3: // aggettivo na
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "でなくてわなりません" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "でなくてわならない" ) );
			break;
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
		case 8:	// verbo irregolare
			get_verbo_base ( str, 1 );
			if ( _cortese )
				str += Glib::ustring ( "なければなりません" );
			else
				str += Glib::ustring ( "なければならない" );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "なければなりません" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "なければならない" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_potenziale ( Glib::ustring &str, bool _cortese ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
			get_verbo_base ( str, 4 );
			if ( _cortese )
				str += Glib::ustring ( "ます" );
			else
				str += Glib::ustring ( "る" );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "られます" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "られる" ) );
			break;
		case 8:	// verbo irregolare
			str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来られる" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "できる" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_passivo ( Glib::ustring &str, bool _cortese ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
			get_verbo_base ( str, 1 );
			if ( _cortese )
				str += Glib::ustring ( "れます" );
			else
				str += Glib::ustring ( "れる" );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "られます" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "られる" ) );
			break;
		case 8:	// verbo irregolare
			str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来られる" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "される" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_causativo ( Glib::ustring &str, bool _cortese ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
			get_verbo_base ( str, 1 );
			if ( _cortese )
				str += Glib::ustring ( "せます" );
			else
				str += Glib::ustring ( "せる" );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _cortese ? _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "させます" ) : _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "させる" ) );
			break;
		case 8:	// verbo irregolare
			str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来させる" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "させる" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_condizionale ( Glib::ustring &str ) const
{
	switch ( _tipo )
	{
		case 4:	// verbo godan transitivo
		case 5:	// verbo godan intransitivo
			get_verbo_base ( str, 4 );
			str += Glib::ustring ( "ば" );
			break;
		case 6:	// verbo ichidan transitivo
		case 7:	// verbo ichidan intransitivo
			str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + Glib::ustring ( "れば" ) );
			break;
		case 8:	// verbo irregolare
			str.assign ( _kotoba.raw() == "来る" ? Glib::ustring ( "来れば" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "すれば" ) );
			break;
		default:
			str.assign ( "" );
			break;
	}
}

void Parola::
get_verbo_base ( Glib::ustring &str, char index ) const
{
	assert(index >= 1 && index <= 5 );
	Glib::ustring::size_type _pos;
	switch ( _tipo )
	{
		case 4:
		case 5:
			_pos = _godanTable.find ( _kotoba.substr (_kotoba.size() - 1) );
			if ( _pos != Glib::ustring::npos )
				str.assign ( _kotoba.substr (0, _kotoba.size() - 1) + _godanTable[ _pos + index ] );
			break;
		case 8:
			if( _kotoba.raw() == "来る" )
					str.assign ( "来" );
				else
				{
					switch ( index )
					{
						case 1:
						case 2:
							str.assign ( _kotoba.substr (0, _kotoba.size() - 2) + "し" );
							break;
						case 3:
							str.assign ( _kotoba );
							break;
						case 4:
							str.assign ( _kotoba.substr (0, _kotoba.size() - 2) + "すれ" );
							break;
						case 5:
							str.assign ( _kotoba.substr (0, _kotoba.size() - 2) + "しろ" );
							break;
					}
				}
			break;
	}
}

void Parola::
get_verbo_in_te ( Glib::ustring &str, bool _ta ) const
{
	Glib::ustring suffisso = _kotoba.substr (_kotoba.size() - 1);
	switch ( _tipo )
	{
		case 4:
		case 5:
			if( suffisso.raw() == "う" || suffisso.raw() == "つ" || suffisso.raw() == "る" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "った" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "って" ) );
			if( suffisso.raw() == "む" || suffisso.raw() == "ぶ" || suffisso.raw() == "ぬ" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "んだ" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "んで" ) );
			if( suffisso.raw() == "く" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "いた" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "いて" ) );
			if( _kotoba.raw() == "行く" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "った" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "って" ) );
			if( suffisso.raw() == "ぐ" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "いだ" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "いで" ) );
			if( suffisso.raw() == "す" )
				str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "した" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "して" ) );
			break;
		case 6:
		case 7:
			str.assign ( _ta ? _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "た" ) : _kotoba.substr ( 0, _kotoba.size() - 1) + Glib::ustring ( "て" ) );
			break;
		case 8:
			if ( _kotoba.raw() == "来る" )
				str.assign ( _ta ? Glib::ustring ( "来た" ) : Glib::ustring ( "来て" ) );
			if ( _kotoba.substr (_kotoba.size() - 2).raw() == "する" )
				str.assign ( _ta ? _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "した" ) : _kotoba.substr (0, _kotoba.size() - 2) + Glib::ustring ( "して" ) );
			break;
	}
}
